package com.group.util;


/**
 * 龙虎榜的排序辅助类
 *
 * @author Zhangyang Hu
 */
public class LongHuBangQuoteChange implements Comparable<LongHuBangQuoteChange> {

    /**
     * Base asset, 比如 bitcoin
     */
    private String baseAsset;

    /**
     * 交易金额的变化幅度， 比如 2.2 表示 百分之2.2
     */
    private Double quoteChange;

    /**
     * 交易金额
     */
    private Double amount;

    public String getBaseAsset() {
        return baseAsset;
    }

    public void setBaseAsset(String baseAsset) {
        this.baseAsset = baseAsset;
    }

    public Double getQuoteChange() {
        return quoteChange;
    }

    public void setQuoteChange(Double quoteChange) {
        this.quoteChange = quoteChange;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public int compareTo(LongHuBangQuoteChange prev) {

        if(quoteChange < prev.getQuoteChange() ) {
            return -1;
        }else if(quoteChange > prev.getQuoteChange()) {
            return 1;
        }else {

            //幅度一样时，看交易金额
            if(amount < prev.getAmount()) {
                return -1;
            }else if(amount > prev.getAmount()) {
                return 1;
            }

            return 0;
        }

    }

}
